Nowadays, more and more terminal devices such as mobile phones begin to use USB interfaces, and use one USB interface for both charging and data communication. Computer USB interfaces and power adapters (Adapters, including standard power adapters and non-standard power adapters) may serve as a power supply to provide currents for terminal devices to charge the terminal devices. However, because the charging currents provided by computer USB interfaces and power adapters are usually different, and the currents provided by power adapters vary according to adapter types, the type of external power supply inserted into a USB interface needs to be identified before a terminal is charged; otherwise, if charging currents are too large, the normal work of a computer or a power adapter is affected, and even the computer or the power adapter is damaged, and if the charging currents are too small, the charging time is prolonged, and therefore the functions of the power adapter capable of fast charging with large currents are not brought into full play.
When a user charges a terminal device with a power adapter through a USB interface, or charges the terminal device through a computer USB interface, or performs data communication through a computer USB interface, the terminal first detects the external USB device connected to the terminal and then performs charging or data communication accordingly.
At present, some processor chips can support the Battery Charging V1.1 and/or Battery Charging V1.2 protocol and have the function of detecting and identifying the power supply type of a USB interface. However, not all processor chips can support the preceding protocols. Sometimes, due to the overall design scheme of a terminal, an external USB interface is not directly a USB interface of a processor, but another interface of the processor such as an NFI or SDRAM interface which is converted by an interface conversion chip into a USB interface and made external. In this case, the power supply type cannot be identified directly through the processor.
In view of the disadvantages of the preceding technology, some semiconductor manufacturers have launched dedicated chips for identifying the type of USB power supply, but the costs are high.
Another solution is to directly connect other peripheral detection devices such as a comparator in parallel on the USB bus. However, the solution is only capable of detecting standard power adapters whose D+ and D− pins are shorted, and incapable of detecting non-standard power adapters with a not-connected D+ pin and a not-connected D− pin or without D+ and D− pins.